package com.bzsys.util;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class ConnUtil {
	
	public static SqlSession getSqlSession(){
		
		Reader reader = null;
		
		String resource = "mybatisConfigure.xml";
		try{
		    reader = Resources.getResourceAsReader(resource);
		}catch(IOException e){
			e.printStackTrace();
		}
		
	    SqlSessionFactory ssf = new SqlSessionFactoryBuilder().build(reader);
	    
	    return ssf.openSession();
	}

}
